package texture;

public class ResourceLocation {
	private final static String defaultDomain=GLReferenceTexture.getDefaultDomain();
	private final String resourceDomain;
	private final String resourcePath;

	public ResourceLocation(String par1Str) {
		String s1 = defaultDomain;
		String s2 = par1Str;
		int i = par1Str.indexOf(58);// key value pair :

		if (i >= 0) {
			s2 = par1Str.substring(i + 1, par1Str.length());

			if (i > 1) {
				s1 = par1Str.substring(0, i);
			}
		}

		this.resourceDomain = s1.toLowerCase();
		this.resourcePath = s2;
	}

	public ResourceLocation(String par1Str, String par2Str) {
		if (par1Str != null && par1Str.length() != 0) {
			this.resourceDomain = par1Str;
		} else {
			this.resourceDomain = defaultDomain;
		}

		this.resourcePath = par2Str;
	}

	public String getResourceDomain() {
		return resourceDomain;
	}

	public String getResourcePath() {
		return resourcePath;
	}

	public String toString() {
		return this.resourceDomain + ":" + this.resourcePath;
	}
}
